package com.ruoyi.platform.controller;

import java.util.List;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.log.annotation.Log;
import com.ruoyi.common.log.enums.BusinessType;
import com.ruoyi.common.security.annotation.RequiresPermissions;
import com.ruoyi.platform.domain.TbDriverApp;
import com.ruoyi.platform.service.ITbDriverAppService;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.utils.poi.ExcelUtil;
import com.ruoyi.common.core.web.page.TableDataInfo;

/**
 * 司机端APP优化Controller
 * 
 * @author ruoyi
 * @date 2025-08-18
 */
@RestController
@RequestMapping("/apps")
public class TbDriverAppController extends BaseController
{
    @Autowired
    private ITbDriverAppService tbDriverAppService;

    /**
     * 查询司机端APP优化列表
     */
    //@RequiresPermissions("platform:apps:list")
    @GetMapping("/list")
    public TableDataInfo list(TbDriverApp tbDriverApp)
    {
        startPage();
        List<TbDriverApp> list = tbDriverAppService.selectTbDriverAppList(tbDriverApp);
        return getDataTable(list);
    }

    /**
     * 导出司机端APP优化列表
     */
    //@RequiresPermissions("platform:apps:export")
    @Log(title = "司机端APP优化", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, TbDriverApp tbDriverApp)
    {
        List<TbDriverApp> list = tbDriverAppService.selectTbDriverAppList(tbDriverApp);
        ExcelUtil<TbDriverApp> util = new ExcelUtil<TbDriverApp>(TbDriverApp.class);
        util.exportExcel(response, list, "司机端APP优化数据");
    }

    /**
     * 获取司机端APP优化详细信息
     */
    //@RequiresPermissions("platform:apps:query")
    @GetMapping(value = "/{driverAppId}")
    public AjaxResult getInfo(@PathVariable("driverAppId") Long driverAppId)
    {
        return success(tbDriverAppService.selectTbDriverAppByDriverAppId(driverAppId));
    }

    /**
     * 新增司机端APP优化
     */
    //@RequiresPermissions("platform:apps:add")
    @Log(title = "司机端APP优化", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody TbDriverApp tbDriverApp)
    {
        return toAjax(tbDriverAppService.insertTbDriverApp(tbDriverApp));
    }

    /**
     * 修改司机端APP优化
     */
    //@RequiresPermissions("platform:apps:edit")
    @Log(title = "司机端APP优化", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody TbDriverApp tbDriverApp)
    {
        return toAjax(tbDriverAppService.updateTbDriverApp(tbDriverApp));
    }

    /**
     * 删除司机端APP优化
     */
    //@RequiresPermissions("platform:apps:remove")
    @Log(title = "司机端APP优化", businessType = BusinessType.DELETE)
	@DeleteMapping("/{driverAppIds}")
    public AjaxResult remove(@PathVariable Long[] driverAppIds)
    {
        return toAjax(tbDriverAppService.deleteTbDriverAppByDriverAppIds(driverAppIds));
    }
}
